package com.exrobot.module.rbt.dal.mysql.order;

import java.util.*;

import com.exrobot.framework.common.pojo.PageResult;
import com.exrobot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.exrobot.framework.mybatis.core.mapper.BaseMapperX;
import com.exrobot.module.rbt.dal.dataobject.order.OrderDO;
import org.apache.ibatis.annotations.Mapper;
import com.exrobot.module.rbt.controller.admin.order.vo.*;

/**
 * 食堂信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OrderMapper extends BaseMapperX<OrderDO> {

    default PageResult<OrderDO> selectPage(OrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
                .eqIfPresent(OrderDO::getCanteenSn, reqVO.getCanteenSn())
                .eqIfPresent(OrderDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(OrderDO::getSaveCode,reqVO.getSaveCode())
                .eqIfPresent(OrderDO::getOrderSn, reqVO.getOrderSn())
                .inIfPresent(OrderDO::getOrderSn,reqVO.getOrderSns())
                .eqIfPresent(OrderDO::getCheckCode, reqVO.getCheckCode())
                .eqIfPresent(OrderDO::getPoint, reqVO.getPoint())
                .betweenIfPresent(OrderDO::getOrderTime, reqVO.getOrderTime())
                .betweenIfPresent(OrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderDO::getId));
    }

}